import 'package:share_fit/app/tools/app_const.dart';
import 'package:uteped_sdk/uteped_sdk.dart';
import 'package:logger/logger.dart';

var logger2 = Logger(
  printer: PrettyPrinter(
      methodCount: 3, // Number of method calls to be displayed
      errorMethodCount: 8, // Number of method calls if stacktrace is provided
      lineLength: 120, // Width of the output
      colors: true, // Colorful log messages
      printEmojis: true, // Print an emoji for each log message
      printTime: false // Should each log print contain a timestamp
  ),
);

var logger = LogUtils();

class LogUtils {
  static const String _tag = "flutter";

  static const typeVerbose = 2;
  static const typeDebug = 3;
  static const typeInfo = 4;
  static const typeWarn = 5;
  static const typeError = 6;

  void v(dynamic message) {
    _log(typeVerbose, _tag, message);
  }

  void d(dynamic message) {
    _log(AppConst.isDebug ? typeInfo : typeDebug, _tag, message);
  }

  void i(dynamic message) {
    _log(typeInfo, _tag, message);
  }

  void w(dynamic message) {
    _log(typeWarn, _tag, message);
  }

  void e(dynamic message) {
    _log(typeError, _tag, message);
  }

  void _log(int type, String tag, dynamic message) {
    Map<String, Object> map = {};
    map["path"] = "device";
    map["method"] = "log";
    map["tag"] = tag;
    map["type"] = type;
    map["value"] = message.toString();

    UTEPedSdk.uteSdk.vFunc(map);
  }
}